home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
752
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
2KB
Path: Rezonet.net!news
From: ray@ultimate-tech.com (Ray Dunn)
Newsgroups: comp.lang.c,comp.std.c,finet.atk.kielet.c
Subject: Re: TYPEDEF and Watcom C++ 10.5
Date: 16 Apr 1996 19:20:40 GMT
Organization: Ultimate Technographics Inc.
Distribution: world
Message-ID: <4l0ru8$jol@ns.RezoNet.NET>
References: <4jlu1r$cs7@nic.dataphone.se> <4kmaeb$10qi@pulp.ucs.ualberta.ca>
NNTP-Posting-Host: 204.19.230.7
Mime-Version: 1.0
Content-Type: Text/Plain; charset=US-ASCII
X-Newsreader: WinVN 0.99.7
In referenced article, Darin McBride says...
>
>Jarmo Paavilainen (skorpio@dataphone.se) wrote:
>
>> typedef struct
>> {
>> WORD CheckSum;
>> WORD Version;
>> BYTE PatchLevel;
>> BYTE Name[21];
>> WORD MarkerVersion;
>> }VERSION_TAG_STRUCT;
>
>> Shouldn't sizeof(VERSION_TAG_STRUCT) always result in 28. By other
>> words shouldn't WORD always be 16 bits and BYTE 8 bits.
>
>Usually, yes.
>
>> If so why does my compiler claim that sizeof(VERSION_TAG_STRUCT) ==
>> 34.
>> All this in 32 bit OS/2 PM and Watcom C++ 10.5
Here is the key *32-bit*.
Words are therefore (presumably) 32-bits, i.e. 4 bytes. But of course
that all depends on how WORD is defined. Neither WORD not BYTE are
standard 'C' types, but of course it is reasonable to guess.
>>You probably have double-word alignment (i.e., pack(4)):
No, no special packing involved, 3 * 4 bytes for the WORD's plus 22
bytes for the BYTE's == 34.
[posted and emailed]
--
Ray Dunn (opinions are my own) | Phone: (514) 938 9050
Montreal | Phax : (514) 938 5225
ray@ultimate-tech.com | Home : (514) 630 3749